package Day7;

public class Triangle extends Tu {
    private double a;
    private double b;
    private double c;

    public Triangle(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    public double getA() {
        return a;
    }

    public void setA(double a) {
        this.a = a;
    }

    public double getB() {
        return b;
    }

    public void setB(double b) {
        this.b = b;
    }

    public double getC() {
        return c;
    }

    public void setC(double c) {
        this.c = c;
    }

    public Triangle() {
    }


    @Override
    public double area() {
        System.out.print("三角形的面积是：");
        double w=(a+b+c)/2;
        double s=w*(w-a)*(w-b)*(w-c);
        return Math.sqrt(s);
    }

    @Override
    public double perimeter() {
        System.out.print("三角形的周长是：");
        return a+b+c;
    }
}
